// components/like/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    like:{
      type:Boolean
    },
    count:{
      type:Number,
      value:0
    }
    
  },
// 尝试使用wxs来解决
  /**
   * 组件的初始数据
   */
  data: {
    like:true,
    dislikeImage: 'images/like@dis.png',
    likeImage: 'images/like.png',
  },
  
  /**
   * 组件的方法列表
   */
  methods: {
    onLike: function(){
      let like = this.properties.like
      let count = this.properties.count
      this.setData({
        like:!like,
        count:like?count-1:count+1,
        })
      let bihevior = this.properties.like ? 'like' : 'concel'
       this.triggerEvent('like',{
        bihevior: bihevior
      },{})
    }
  }
})